package online.sh.cn.fy.common.utils;

public class CompareState {
	public static String getMaxState(String[] setday){
		 int[] array = new int[setday.length];
		 for(int i = 0; i <setday.length; i++){
			 array[i] = Integer.parseInt(setday[i]);
		 }
       int temp;
       for (int i = 0; i < array.length; i++) {
           for (int j = i+1; j < array.length; j++) {
               if (array[i] < array[j]) {
                   temp = array[i];
                   array[i] = array[j];
                   array[j] = temp;  // 两个数交换位置
               }
           }
       }
       int valuea=1;
       int valueb=0;
       for (int i = 0; i < array.length; i++) {
       	if (i==array.length-1) {
				if (array[i-1]-array[i]==1) {
					valuea++;
					if (valuea>=valueb) {
						valueb=valuea-1;
					}
				}else{
					valuea=1;
				}
			}else{
				if (array[i] - array[i+1]==1) {
					valuea++;
					if (valuea>=valueb) {
						valueb=valuea;
					}
				}else{
					if (valuea>=valueb) {
						valueb=valuea;
	                    valuea=1;
					}else{
						valuea=1;
					}
				}
			}
       }
       return String.valueOf(valueb);
	}
}
